/*
 * conf.h
 *
 * Created: 2012-06-01 18:19:14
 *  Author: Sebastian_2
 */ 


#ifndef CONF_H_
#define CONF_H_

#define ATMEGA 

#ifndef ATMEGA
#define SSD1289_DATA_HI		PORTA
#define SSD1289_DATA_LO		PORTF
#define SSD1289_CONFIG		PORTB
#define SSD1289_RS_BIT		(1 << 0)
#define SSD1289_WR_BIT		(1 << 1)
#define SSD1289_RD_BIT		(1 << 2)
#define SSD1289_CS_BIT		(1 << 3)
#else
#define DATA_PORT	PORTA
#define DATA_DDR	DDRA
#define RS_DDR 		DDRD
#define RS_PORT 	PORTD
#define RS_BIT		2
#define WR_DDR		DDRD
#define WR_PORT		PORTD
#define WR_BIT		4
#define RD_DDR		DDRD
#define RD_PORT		PORTD
#define RD_BIT		6
#define CS_DDR		DDRB
#define CS_PORT		PORTB
#define CS_BIT		3
#define RESET_DDR	DDRB
#define RESET_PORT	PORTB
#define RESET_BIT	1
#define LATCH_DDR	DDRC
#define LATCH_PORT	PORTC
#define LATCH_BIT	7
#define LED_DDR		DDRC
#define LED_PORT	PORTC
#define LED_BIT		6
#endif

#define ADS7843_SAMPLES		8
#ifndef ATMEGA
#define ADS7843_BAUD		2000000 // 2 MHz
#define ADS7843_BAUDCTL		(F_CPU/(2*ADS7843_BAUD))-1
#define ADS7843_USART		USARTC1
#define ADS7843_PORT		PORTC
#define ADS7843_INT_bm		(1 << 3)
#define ADS7843_CS_bm		(1 << 4)
#define ADS7843_CS_SET()	ADS7843_PORT.OUTSET = ADS7843_CS_bm
#define ADS7843_CS_CLR()	ADS7843_PORT.OUTCLR = ADS7843_CS_bm
#else
#define ADS7843_BUSY_DDR	DDRD
#define ADS7843_BUSY_PORT	PORTD
#define ADS7843_BUSY_PIN	PIND
#define ADS7843_BUSY_BIT	1
#define ADS7843_CS_DDR		DDRD
#define ADS7843_CS_PORT		PORTD
#define ADS7843_CS_PIN		PIND
#define ADS7843_CS_BIT		5
#define ADS7843_INT_DDR		DDRD
#define ADS7843_INT_PORT	PORTD
#define ADS7843_INT_PIN		PIND
#define ADS7843_INT_BIT		3
#endif

#define GLOBAL_TWI			TWIC
#define GLOBAL_TWI_BAUD		155 // 100kHz

#define MCP79410_PORT		PORTC
#define MCP79410_INT_bm		(1 << 2)

#define VS1003_BAUD			16000000 // 16 MHz
#define VS1003_BUFSIZE		512
#define VS1003_USART		USARTD1
#define VS1003_DCS_PORT		PORTD
#define VS1003_DCS_bm		(1 << 2)
#define VS1003_DCS_SET()	VS1003_DCS_PORT.OUTSET = VS1003_DCS_bm
#define VS1003_DCS_CLR()	VS1003_DCS_PORT.OUTCLR = VS1003_DCS_bm
#define VS1003_CS_PORT		PORTD
#define VS1003_CS_bm		(1 << 3)
#define VS1003_CS_SET()		VS1003_CS_PORT.OUTSET = VS1003_CS_bm
#define VS1003_CS_CLR()		VS1003_CS_PORT.OUTCLR = VS1003_CS_bm
#define VS1003_RESET_PORT	PORTD
#define VS1003_RESET_bm		(1 << 4)
#define VS1003_RESET_SET()	VS1003_RESET_PORT.OUTSET = VS1003_RESET_bm
#define VS1003_RESET_CLR()	VS1003_RESET_PORT.OUTCLR = VS1003_RESET_bm
#define VS1003_DREQ_PORT	PORTE
#define VS1003_DREQ_bm		(1 << 1)

// menu stuff
#define ITEMS_ON_PAGE	6
#define ARTISTS_LEN		40
#define ARTISTS_MAX		32


#endif /* CONF_H_ */